#include <iostream>
#include <string>
#include "boost/lexical_cast.hpp"
#include <json/json.h>
#include <json/value.h>
#include <json/reader.h>
#include "RedisMgr.h"
/*
void testBoost()
{
	using namespace std;
	cout << "Enter your weight: ";
	float weight;
	cin >> weight;
	string gain = "A 10% increase raises ";
	string wt = boost::lexical_cast<string> (weight);
	gain = gain + wt + " to ";      // string operator()
	weight = 1.1 * weight;
	gain = gain + boost::lexical_cast<string>(weight) + ".";
	cout << gain << endl;
}

void testJsonCpp()
{
	Json::Value root;
	root["id"] = 1001;
	root["data"] = "hello world";
	std::string request = root.toStyledString();
	std::cout << "request is " << request << std::endl;

	Json::Value root2;
	Json::Reader reader;
	reader.parse(request, root2);
	std::cout << "msg id is " << root2["id"] << " msg is " << root2["data"] << std::endl;

	system("pause");
}

void TestRedisMgr() {
	assert(RedisMgr::GetInstance()->Connect("127.0.0.1", 6379));
	assert(RedisMgr::GetInstance()->Auth("123"));
	assert(RedisMgr::GetInstance()->Set("blogwebsite", "llfc.club"));
	std::string value = "";
	assert(RedisMgr::GetInstance()->Get("blogwebsite", value));
	assert(RedisMgr::GetInstance()->Get("nonekey", value) == false);
	assert(RedisMgr::GetInstance()->HSet("bloginfo", "blogwebsite", "llfc.club"));
	assert(RedisMgr::GetInstance()->HGet("bloginfo", "blogwebsite") != "");
	assert(RedisMgr::GetInstance()->ExistsKey("bloginfo"));
	assert(RedisMgr::GetInstance()->Del("bloginfo"));
	assert(RedisMgr::GetInstance()->Del("bloginfo"));
	assert(RedisMgr::GetInstance()->ExistsKey("bloginfo") == false);
	assert(RedisMgr::GetInstance()->LPush("lpushkey1", "lpushvalue1"));
	assert(RedisMgr::GetInstance()->LPush("lpushkey1", "lpushvalue2"));
	assert(RedisMgr::GetInstance()->LPush("lpushkey1", "lpushvalue3"));
	assert(RedisMgr::GetInstance()->RPop("lpushkey1", value));
	assert(RedisMgr::GetInstance()->RPop("lpushkey1", value));
	assert(RedisMgr::GetInstance()->LPop("lpushkey1", value));
	assert(RedisMgr::GetInstance()->LPop("lpushkey2", value) == false);
	RedisMgr::GetInstance()->Close();
}
*/